<h1>IT Department Primer</h1>
<b>Installing Apache, PHP, Mysql and PhpMyAdmin</b>
<br>
<br><a href="index.html">Back to Home</a>
<br>Fished from Google Cache and Republished Verbatim by Jasper Tomas on June 24, 2010
<br><hr>
<h3>Office of Museum Technology</h3><h2>FLMNH Linux Pages</h2>
</td>
      <td><a href="http://www.flmnh.ufl.edu/"><img src="installing%20apache%20php%20myswl_files/Logo_Spot_sm_80pixels.png" alt="Florida Museum of Natural History" border="none"></a><br>
<br>
<a href="http://www.ufl.edu/">
<img src="installing%20apache%20php%20myswl_files/ufblogo.gif" alt="University of Florida" border="none"></a><br>
      </td>
    </tr>
  </tbody>
</table>

<hr>

<h2>Installing <b style="color: black; background-color: rgb(153, 255, 153);">Apache</b>, <b style="color: black; background-color: rgb(160, 255, 255);">PHP</b>, and <b style="color: black; background-color: rgb(255, 153, 153);">MySQL</b> on <b style="color: black; background-color: rgb(255, 255, 102);">Fedora</b> Core</h2>

<br>
This will install the basic components for a dynmaic, database-driven web site.  We use 
yum to handle dependencies and gather all of the required packages.<br><br>

<br>

1. Install <b style="color: black; background-color: rgb(153, 255, 153);">Apache</b> (httpd), <b style="color: black; background-color: rgb(160, 255, 255);">PHP</b>, <b style="color: black; background-color: rgb(255, 153, 153);">MySQL</b> (server and client), and the component that allows
<b style="color: black; background-color: rgb(160, 255, 255);">php</b> to talk to <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>.<br>

<pre> yum -y install httpd <b style="color: black; background-color: rgb(160, 255, 255);">php</b> <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b> <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>-server <b style="color: black; background-color: rgb(160, 255, 255);">php</b>-<b style="color: black; background-color: rgb(255, 153, 153);">mysql</b> <br></pre>

<br>
2. Configure the new services to start automatically<br>

<pre>  /sbin/chkconfig httpd on
  /sbin/chkconfig --add mysqld         [this is not required with FC4 and above]
  /sbin/chkconfig mysqld on
<br>
  /sbin/service httpd start
  /sbin/service mysqld start
</pre>
<br>
3. IMPORTANT! Set up the <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b> database root password.  Without a password, ANY user on the box can login to <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b> as database root.  The <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b> root account is a separate password from the machine root account. <br><br>

<pre> mysqladmin -u root password 'new-password'           [quotes are required]
</pre>

<br>
4. Make additional security-related changes to <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>.

<pre> <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b> -u root -p

 <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>&gt; DROP DATABASE test;                            [removes the test database]
 <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>&gt; DELETE FROM <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>.user WHERE user = '';        [Removes anonymous access]
 <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>&gt; FLUSH PRIVILEGES;

</pre>



5.  Following the above steps, the document root for <b style="color: black; background-color: rgb(153, 255, 153);">Apache</b> is /var/www/html/<br><br>
Create a test <b style="color: black; background-color: rgb(160, 255, 255);">PHP</b> script (such as phpinfo.<b style="color: black; background-color: rgb(160, 255, 255);">php</b>) and place it in the document root.  A useful
test script sample:

<pre> &lt;?<b style="color: black; background-color: rgb(160, 255, 255);">php</b>

    phpinfo();
 ?&gt;
</pre>

6.  Create a database and database user for your data.  You will use this database and user name
in your database connection string.  The GRANT statement actually creates a new <b style="color: black; background-color: rgb(255, 153, 153);">MySQL</b> user account.

<pre> <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>&gt; CREATE DATABASE web_db; 
 <b style="color: black; background-color: rgb(255, 153, 153);">mysql</b>&gt; GRANT ALL PRIVILEGES ON web_db.* TO 'web_user'@'localhost' IDENTIFIED BY 'thepassword'; 
</pre>

<br>
<hr style="width: 100%; height: 2px;">Last Update 7/1/2005 by Dan Stoner<span style="font-weight: bold;"></span><br>
<hr>
<table>
  <tbody>
    <tr>
      <td>Send us an email:<br><a href="mailto:linuxpages-at-flmnh.ufl.edu?subject=LinuxPages%20Comment%20or%20Question"> linuxpages-at-flmnh.ufl.edu</a><br> <i>(Replace '-at-' with '@')</i>
